# *************************************************************************************** #
# ---------------------------------- EULA NOTICE ---------------------------------------- #
#                     Agreement between "Haroon Awan" and "You"(user).                    #
# ---------------------------------- EULA NOTICE ---------------------------------------- #
#  1. By using this piece of software your bound to these point.                          #
#  2. This an End User License Agreement (EULA) is a legal between a software application #
#     author "Haroon Awan" and (YOU) user of this software.                               #
#  3. This software application grants users rights to use for any purpose or modify and  #
#     redistribute creative works.                                                        #
#  4. This software comes in "is-as" warranty, author "Haroon Awan" take no responsbility #
#     what you do with by/this software as your free to use this software.                #
#  5. Any other purpose(s) that it suites as long as it is not related to any kind of     #
#     crime or using it in un-authorized environment.                                     #
#  6. You can use this software to protect and secure your data information in any        #
#     environment.                                                                        #
#  7. It can also be used in state of being protection against the unauthorized use of    #
#     information.                                                                        #
#  8. It can be used to take measures achieve protection.                                 #
# *************************************************************************************** #

#!/bin/bash

red="\e[0;31m"
green="\e[0;32m"
off="\e[0m"

function banner() {
clear
echo "                                                                                               ";
echo "                                                                                               ";
echo "                                                                                               ";
echo "        ..............###     ##  ######  ######  #######.............. "; 
echo "        ........      ###     ##  ##  ##  ##  ##  ##    ##     ........	  "; 
echo "        .....         ## #    ##  ##  ##  ##  ##  ##  ##         .....          "; 
echo "        ......        ##  #   ##  ##  ##  ##  ##  ## ##         ......	  "; 
echo "        ......        ##    # ##  ##  ##  ##  ##  ##   ##        ......	  "; 
echo "        ........      ##     ###  ##  ##  ##  ##  ##    ##     ........	  "; 
echo "        ..............##     ###  ######  ######  #######..............     ";  
echo "                       Noob Pentesting Framework     Version 1.9a        ";   
echo "                             [Coded By: Haroon Awan]                                       ";
echo "                               [Concept: Gewn001]                                       ";
echo "                        [Contact: mrharoonawan@gmail.com]                                  ";
echo "                                                                                               ";
echo "                                                                                               ";
echo "                                                                                               ";
}

function linux() {
echo -e "$red [$green+$red]$off Installing Perl ...";
sudo apt-get install -y perl
echo -e "$red [$green+$red]$off Installing JSON Module ...";
cpan install JSON
echo -e "$red [$green+$red]$off Installing Extra Perl Modules ...";
echo "y" | cpan install WWW::Mechanize
echo "y" | cpan install use HTML::TokeParser
echo "y" | cpan install Term::ANSIColor
echo "y" | cpan install Mojo::DOM
echo "y" | cpan install Data::Dumper
echo "y" | cpan install Win32::Console::ANSI
echo "y" | cpan install HTML::TableExtract
echo "y" | cpan install Data::Validate::Domain
echo "y" | cpan install LWP::Protocol::https
echo "y" | cpan install Mozilla::CA
echo "y" | cpan install Bundle::LWP
echo "y" | cpan -fi Mojo 
echo "y" | cpan -fi Mojo::DOM 
echo "y" | cpan -fi HTML::TokeParser
echo "y" | cpan -fi HTTP::Request
echo "y" | cpan -fi LWP::Simple
echo "y" | cpan -fi LWP::UserAgent
echo "y" | cpan -fi IO::Socket::INET
echo "y" | cpan -fi Term::ANSIColor
echo "y" | cpan -fi IO::Select
echo "y" | cpan -fi HTTP::Response
echo "y" | cpan -fi HTTP::Request::Common
echo "y" | cpan -fi URI::URL
echo "y" | cpan -fi  feature ':5.10'
echo "y" | cpan -fi LWP::UserAgent
echo "y" | cpan -fi Term::ANSIColor
echo "y" | cpan -fi LWP::UserAgent
echo "y" | cpan -fi Term::ANSIColor
echo "y" | cpan -fi Data::Validate::Domain



echo -e "$red [$green+$red]$off Checking directories..."
if [ -d "/usr/share/Noob" ]; then
    echo -e "$red [$green+$red]$off A Directory Noob Was Found! Do You Want To Replace It? [Y/n]:" ;
    read replace
    if [ "$replace" = "Y" ]; then
      sudo rm -r "/usr/share/Noob"
      sudo rm "/usr/share/icons/Noob.png"
      sudo rm "/usr/share/applications/Noob.desktop"
      sudo rm "/usr/local/bin/Noob"

else
echo -e "$red [$green+$red]$off If You Want To Install You Must Remove Previous Installations";
        exit
    fi
fi 

echo -e "$red [$green+$red]$off Installing ...";
echo -e "$red [$green+$red]$off Creating Symbolic Link ...";
echo -e "#!/bin/bash
perl /usr/share/Noob/Noob-Pentesting-Framework.pl" '${1+"$@"}' > "Noob";
    chmod +x "Noob";
    sudo mkdir "/usr/share/Noob"
    sudo cp "Kali_Installer.sh" "/usr/share/Noob"
    sudo cp "Noob-Pentesting-Framework.pl" "/usr/share/Noob"
    sudo cp "config/Noob.jpeg" "/usr/share/icons"
    sudo cp "config/Noob.desktop" "/usr/share/applications"
    sudo cp "Noob" "/usr/local/bin/"
    rm "Noob";

echo -e "$red [$green+$red]$off Installing dependencies..."
echo "y" | apt-get install gem
gem install wayback_machine_downloader
echo "y" | apt-get install perl-LWP-Protocol-https
echo "y" | git clone https://github.com/haroonawanofficial/vasl.git
echo "y" | git clone https://github.com/haroonawanofficial/ShaheenX.git
echo "y" | git clone https://github.com/craighays/bucketkicker.git
echo "y" | git clone https://github.com/ghostlulzhacks/svg_test.git
echo "y" | git clone https://github.com/ghostlulzhacks/waybackSqliScanner.git

echo -e "$red [$green+$red]$off Installing Go Language Modules..."
echo "y" | apt-get golang

echo -e "$red [$green+$red]$off Python2 and Python3 Modules..."
sudo pip install -r requirements.txt
sudo pip3 install -r requirements.txt
pip install jsbeautifier
pip install argparse
pip install requests
pip install request
pip3 install jsbeautifier
pip3 install argparse
pip3 install requests
pip3 install request

chmod u+x *.sh
cp * -r /usr/share/Noob
cp *.sh /usr/share/Noob

if [ -d "/usr/share/Noob" ] ;
then
echo -e "$red [$green+$red]$off Noob Successfully Installed, Starting";
sleep 2;
Noob
else
echo -e "$red [$green+$red]$off Noob Cannot Be Installed. Trying using Portable Edition !";
    exit
fi 
}

if [ -d "/usr/bin/" ];then
banner
echo -e "$red [$green+$red]$off Noob Will Be Installed In Your System";
linux
else
echo -e "$red [$green+$red]$off Noob Cannot Be Installed. Trying using Portable Edition !";
    exit
fi
